<?php
my_component_load('testing' , false);
my_component_load('paging' , false);   
my_component_load('pendaftaran_pelatihan' );
$task = isset($_GET['task']) ? $_GET['task'] : ""; 
$id = isset( $_GET['id'] ) ? $_GET['id']:  0;
$sid = isset( $_GET['sid'] ) ? $_GET['sid']:  0;
$modulname="Diklat _BN_ Planning _BN_ Scheduling" ;

if($_SERVER['REQUEST_METHOD'] == "POST"){
	switch($task){
		case "edit_page": 
			submit_pendaftaran_peserta($id);
			generate_my_web("Updated","","plain.php");
			exit; 
		break;
	}
}else{
	switch($task){
		case "edit": 
			$title= ($id > '0' ) ?  "Perubahan Data" : "Tambah Data";
			facebox_page('index.php?com=pendaftaran_pelatihan&task=edit_page&id='.$id , $title , 210	); 
			break;
		case "edit_page": 
			$content  = form_pendaftaran_peserta($id);
			generate_my_web($content,"","plain.php");
			exit; 
			break;
		case "delete": 	
			delete_pendaftaran_peserta($id,$sid);
			my_direct('index.php?com='.$_GET['com'].'&task=detail&id='.$id);			
			break;
		case "detail":
			load_facebox_script();
			$content = detail_peserta_pelatihan($id);
			$pagename =$modulname." _BN_ Daftar Peserta";
			break;
		case "cetak":	
			@ob_end_clean(); 
			echo'<pre>';
			echo print_plain($id);
			exit;
		default:
			load_facebox_script();
			$content =list_pelatihan();
			$pagename=$modulname ;
			break;
	}
}

generate_my_web( $content , $pagename );